.class public Lcom/zuiapps/library/parse/UpgradeParse;
.super Ljava/lang/Object;
.source "UpgradeParse.java"


# static fields
.field private static final TAG:Ljava/lang/String; = "UpgradeParse"


# direct methods
.method public constructor <init>()V
    .registers 1

    .prologue
    .line 16
    invoke-direct {p0}, Ljava/lang/Object;-><init>()V

    return-void
.end method

.method public static parse(Landroid/content/Context;Lorg/json/JSONObject;)Lcom/zuiapps/library/model/UpgradeModel;
    .registers 8
    .param p0, "context"    # Landroid/content/Context;
    .param p1, "jObj"    # Lorg/json/JSONObject;

    .prologue
    const/4 v5, 0x2

    .line 21
    :try_start_1
    new-instance v0, Lcom/zuiapps/library/model/UpgradeModel;

    invoke-direct {v0}, Lcom/zuiapps/library/model/UpgradeModel;-><init>()V

    .line 22
    .local v0, "model":Lcom/zuiapps/library/model/UpgradeModel;
    const-string v3, "apk_url"

    invoke-virtual {p1, v3}, Lorg/json/JSONObject;->optString(Ljava/lang/String;)Ljava/lang/String;

    move-result-object v3

    iput-object v3, v0, Lcom/zuiapps/library/model/UpgradeModel;->apkUrl:Ljava/lang/String;

    .line 23
    const-string v3, "update_type"

    const/4 v4, 0x2

    invoke-virtual {p1, v3, v4}, Lorg/json/JSONObject;->optInt(Ljava/lang/String;I)I

    move-result v2

    .line 24
    .local v2, "updateType":I
    const/4 v3, 0x1

    if-ne v2, v3, :cond_35

    .line 25
    sget-object v3, Lcom/zuiapps/library/model/UpgradeModel$UpgradeType;->FORCE:Lcom/zuiapps/library/model/UpgradeModel$UpgradeType;

    iput-object v3, v0, Lcom/zuiapps/library/model/UpgradeModel;->upgradeType:Lcom/zuiapps/library/model/UpgradeModel$UpgradeType;

    .line 31
    :goto_1c
    const-string v3, "apk_url"

    invoke-virtual {p1, v3}, Lorg/json/JSONObject;->optString(Ljava/lang/String;)Ljava/lang/String;

    move-result-object v3

    iput-object v3, v0, Lcom/zuiapps/library/model/UpgradeModel;->apkUrl:Ljava/lang/String;

    .line 32
    const-string v3, "update_desc"

    invoke-virtual {p1, v3}, Lorg/json/JSONObject;->optString(Ljava/lang/String;)Ljava/lang/String;

    move-result-object v3

    iput-object v3, v0, Lcom/zuiapps/library/model/UpgradeModel;->desc:Ljava/lang/String;

    .line 33
    const-string v3, "last_ver_code"

    invoke-virtual {p1, v3}, Lorg/json/JSONObject;->optInt(Ljava/lang/String;)I

    move-result v3

    iput v3, v0, Lcom/zuiapps/library/model/UpgradeModel;->lastVersion:I

    .line 38
    .end local v0    # "model":Lcom/zuiapps/library/model/UpgradeModel;
    .end local v2    # "updateType":I
    :goto_34
    return-object v0

    .line 26
    .restart local v0    # "model":Lcom/zuiapps/library/model/UpgradeModel;
    .restart local v2    # "updateType":I
    :cond_35
    if-ne v2, v5, :cond_42

    .line 27
    sget-object v3, Lcom/zuiapps/library/model/UpgradeModel$UpgradeType;->IGNORE:Lcom/zuiapps/library/model/UpgradeModel$UpgradeType;

    iput-object v3, v0, Lcom/zuiapps/library/model/UpgradeModel;->upgradeType:Lcom/zuiapps/library/model/UpgradeModel$UpgradeType;
    :try_end_3b
    .catch Ljava/lang/Throwable; {:try_start_1 .. :try_end_3b} :catch_3c

    goto :goto_1c

    .line 35
    .end local v0    # "model":Lcom/zuiapps/library/model/UpgradeModel;
    .end local v2    # "updateType":I
    :catch_3c
    move-exception v1

    .line 36
    .local v1, "t":Ljava/lang/Throwable;
    invoke-virtual {v1}, Ljava/lang/Throwable;->printStackTrace()V

    .line 38
    const/4 v0, 0x0

    goto :goto_34

    .line 29
    .end local v1    # "t":Ljava/lang/Throwable;
    .restart local v0    # "model":Lcom/zuiapps/library/model/UpgradeModel;
    .restart local v2    # "updateType":I
    :cond_42
    :try_start_42
    sget-object v3, Lcom/zuiapps/library/model/UpgradeModel$UpgradeType;->NEXT:Lcom/zuiapps/library/model/UpgradeModel$UpgradeType;

    iput-object v3, v0, Lcom/zuiapps/library/model/UpgradeModel;->upgradeType:Lcom/zuiapps/library/model/UpgradeModel$UpgradeType;
    :try_end_46
    .catch Ljava/lang/Throwable; {:try_start_42 .. :try_end_46} :catch_3c

    goto :goto_1c
.end method
